vtorc: cleanup discover queue, add concurrency flag#17825
Merged
deepthi merged 19 commits intovitessio:mainfrom Mar 5, 2025
Merged
vtorc: cleanup discover queue, add concurrency flag#17825deepthi merged 19 commits intovitessio:mainfrom
vtorc: cleanup discover queue, add concurrency flag#17825deepthi merged 19 commits intovitessio:mainfrom
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR cleans up the VTOrc discover queue code, mainly by removing all locking from
.Consume(); this was achieved by addingtype queueItem structand pushing this to the channel instead, with the key andtime.Timeincluded. Previously thistime.Timewas stored in amapwith mutex locksThe
.QueueLen()now returns just thelen()of the queue channel. Before this metric would include the length of the channel plus all that are "in processing" (between.Consume()and.Release()), which I'm unsure is necessary. Simplifying this removed the need for a lock in.QueueLen()Finally, the
--discovery-workersflag was added to control how many workers consume the discovery queueBenchmark:
tvaillancourt@tvailla-ltmawfe vitess % go test -v -bench=. ./go/vt/vtorc/discovery/... === RUN TestQueue --- PASS: TestQueue (0.00s) goos: darwin goarch: arm64 pkg: vitess.io/vitess/go/vt/vtorc/discovery cpu: Apple M3 Max BenchmarkQueues BenchmarkQueues/New BenchmarkQueues/New-14 4726 244573 ns/op BenchmarkQueues/Legacy BenchmarkQueues/Legacy-14 3610 338468 ns/op PASS ok vitess.io/vitess/go/vt/vtorc/discovery 3.923sNOTE:
New== this PR,Legacy== current queueRelated Issue(s)
#17330
Checklist
Deployment Notes